//
//  LGSeviceStatisticsCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/5/8.
//

#import "LGSeviceStatisticsCell.h"

#import "LGSeviceStatisticsItem.h"
#define itemW   (Screen_W-viewPix(32))/3.0
#define itemH   viewPix(70)
@interface LGSeviceStatisticsCell()
/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)LGSeviceStatisticsItem *patientItem;
/**   */
@property (nonatomic , strong)LGSeviceStatisticsItem *serviceItem;
/**   */
@property (nonatomic , strong)LGSeviceStatisticsItem *teamItem;

@end

@implementation LGSeviceStatisticsCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.contentView.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:self.baseView];
        [self.baseView addSubview:self.titleLabel];
        [self.baseView addSubview:self.patientItem];
        [self.baseView addSubview:self.serviceItem];
        [self.baseView addSubview:self.teamItem];
    }
    return  self;
}

-(void)setDataDic:(NSDictionary *)dataDic{
    _dataDic = dataDic;
    self.patientItem.content = LGNSString(dataDic[@"patient_count"]);
    self.serviceItem.content = LGNSString(dataDic[@"vip_count"]);
    self.teamItem.content = LGNSString(dataDic[@"team_appoint_count"]);
}

#pragma mark
#pragma mark ====> 创建控件
-(UIView *)baseView{
    if(!_baseView){
        _baseView = [[UIView alloc] initWithFrame:CGRectMake(viewPix(16), viewPix(8), Screen_W-viewPix(32), viewPix(114))];
        [_baseView setShadoWithColor:@"#B2BDC7" offset:CGSizeMake(0, 2) opacity:0.1 radius:10];
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"个人统计" colorString:@"#000000" textFont:LGFontWeight(16, UIFontWeightSemibold) textAlignment:NSTextAlignmentLeft lines:1];
        _titleLabel.frame = CGRectMake(viewPix(16), viewPix(12), Screen_W-viewPix(64), viewPix(22));
    }
    return _titleLabel;
}


-(LGSeviceStatisticsItem *)patientItem{
    if(!_patientItem){
        _patientItem = [[LGSeviceStatisticsItem alloc]initWithFrame:CGRectMake(0, viewPix(40), itemW, itemH)];
        _patientItem.title = @"新增患者";
        _patientItem.content = @"0";
    }
    return _patientItem;
}

-(LGSeviceStatisticsItem *)serviceItem{
    if(!_serviceItem){
        _serviceItem = [[LGSeviceStatisticsItem alloc]initWithFrame:CGRectMake(kMaxX(self.patientItem.frame), kMinY(self.patientItem.frame), itemW, itemH)];
        _serviceItem.title = @"新增服务包";
        _serviceItem.content = @"0";
    }
    return _serviceItem;
}

-(LGSeviceStatisticsItem *)teamItem{
    if(!_teamItem){
        _teamItem = [[LGSeviceStatisticsItem alloc]initWithFrame:CGRectMake(kMaxX(self.serviceItem.frame), kMinY(self.patientItem.frame), itemW, itemH)];
        _teamItem.title = @"团队咨询";
        _teamItem.content = @"0";
    }
    return _teamItem;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
